# Makefile for ce-tddft

QE_SOURCE=@qe_source@
include $(QE_SOURCE)/make.sys
DFLAGS += @dflags_tddft@

# location of needed modules
MODFLAGS = $(MOD_FLAG)$(QE_SOURCE)/iotk/src $(MOD_FLAG)$(QE_SOURCE)/Modules \
           $(MOD_FLAG)$(QE_SOURCE)/PW/src $(MOD_FLAG).

TDDFT_OBJS = tddft_version.o tddft_module.o tddft_main.o tddft_routines.o \
	     tddft_setup.o tddft_ch_psi_all.o tddft_cgsolver.o \
	     update_ham.o apply_efield.o molecule_optical_absorption.o \
	     molecule_operators.o 

LIBOBJS = $(QE_SOURCE)/flib/ptools.a $(QE_SOURCE)/flib/flib.a $(QE_SOURCE)/clib/clib.a \
 	  $(QE_SOURCE)/iotk/src/libiotk.a
ifeq ($(wildcard $(QE_SOURCE)/Environ),)
  QEMODS = $(QE_SOURCE)/Modules/libqemod.a
else
  QEMODS = $(QE_SOURCE)/Environ/src/libenviron.a $(QE_SOURCE)/Modules/libqemod.a
endif
PWOBJS  = $(QE_SOURCE)/PW/src/libpw.a

all: version tddft.x

version:
	./update_tddft_version

tddft_version.f90: version


tddft.x: $(TDDFT_OBJS) $(PWOBJS) $(QEMODS) $(LIBOBJS)
	$(LD) $(LDFLAGS) -o $@ $(TDDFT_OBJS) $(PWOBJS) $(QEMODS) $(LIBOBJS) $(LIBS)
	(cd ../bin; ln -sf ../src/tddft.x .)

clean:
	-/bin/rm -f tddft.x *.o *.F90 *__genmod.f90 *.d *.mod *.i *.L

distclean: clean
	-/bin/rm -f Makefile make.depend

include make.depend

# DO NOT DELETE

